package com.test.component;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Author：徐志荣
 * @Date：2023/6/11 下午 3:48
 */

//先设置属性,再初始化 的代码演示
@Component
public class DComponent {

    @Autowired
    private EComponent eComponent; //①

    @PostConstruct //②
    public void postConstruct(){
        eComponent.sayHi();  //先 ① 再 ②
        System.out.println("执行了 D的 PostConstruct");
    }
}
